<?
session_start();
if (!session_is_registered('admin')) exit();

$xml = simplexml_load_file($gen['path']."\\configuration.xml");

$current = $xml->theme;
echo "<center>";
echo "<b style=\"font-size: 18;\">Meedio Themes</b><br><br>";
echo "Click on a theme to change theme on your htpc!<br><br>";
echo "<a href=\"do.php?what=themes\">Refresh Themes</a><br>";
echo "</center>";

$sql = @sqlite_query($config, "SELECT * FROM themes ORDER BY name");

$j = 1;
while ($theme = @sqlite_fetch_array($sql)) {
  $id = $theme['id'];
  if ($j == 1) {
    echo "<table width=\"100%\" align=\"center\" cellspacing=\"5\" style=\"margin-top: 20px;\">";
    echo "<tr>";
  }
  echo "<td width=\"50%\" align=\"center\" style=\"border: 1px solid black; padding-top: 20px; padding-bottom: 20px;\">";
  if ($id != $current) echo "<a href=\"do.php?what=theme&id=$id\">";
  if ($theme['image'] != NULL) echo "<img border=\"0\" src=\"thumb.php?id=$id&type=theme&w=250&h=190\"><br>";
  echo "<b>".$theme['name']."</b>";
  if ($id != $current) echo "</a>";
  else echo " - <i>Current Theme</i>";
  echo "</td>";
  if ($j == 2) {
    $j = 1;
    echo "</tr>";
    echo "</table>";
  }
  else $j++;
}

?>
